<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>批发财务审核</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="../../res/css/wholesale/font.css">
  <link rel="stylesheet" href="../../res/css/wholesale/xadmin.css">
  <link rel="stylesheet" href="../../res/layui/css/layui.css">
  <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  <script type="text/javascript" src="../../res/layui/layui.js" charset="utf-8"></script>
  <script type="text/javascript" src="../../res/js/wholesale/xadmin.js"></script>
</head>
<body>
<!-- 刷新<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">批发财务审核</a>
        <a>
          <cite>修改订单</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div> -->
<div class="demoTable" style="margin-top: 10px;">
    <div class="x-body" >
      <div class="layui-row">
        <div class="layui-form layui-col-md12 x-so">
        <!--   <input type="text" name="bwId" id="bwId"   placeholder="批发编号" autocomplete="off" class="layui-input"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> -->
          <input type="text" name="companyName" id="companyName"   placeholder="批发公司" autocomplete="off" class="layui-input"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
          <input type="text" name="bwTime" id="bwTime"   placeholder="批发开始时间" autocomplete="off" class="layui-input" readonly="readonly"> ——
          <input type="text" name="bwTime2" id="bwTime2"   placeholder="批发结束时间" autocomplete="off" class="layui-input" readonly="readonly"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
          <button class="layui-btn" data-type="reload" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
        </div>
      </div>
<table class="layui-table"  lay-data="{url:'../../listenBranchWholesale/auditSelect.action', page:true, id:'idTest'}" lay-filter="demo">
  <thead>
    <tr>
    <!--   <th lay-data="{field:'bwId', align:'center',width:'15%'}">批发编号</th> -->
      <th lay-data="{field:'companyName', align:'center',width:'10%'}">批发公司</th>
      <th lay-data="{field:'bwTimeString', align:'center', templet: '#sellTime',width:'10%'}">批发时间</th>
      <th lay-data="{field:'bwPrice',  align:'center',width:'12%'}">分店销售总金额</th>
      <th lay-data="{field:'bwNumber', align:'center',width:'12%'}">分店销售总数量</th>
      <th lay-data="{field:'oper',  align:'center',width:'12%'}">操作人</th>
      <th lay-data="{field:'operation',  align:'center', toolbar: '#barDemo',width:'12%'}">操作</th>
    </tr>
  </thead>
</table>
 </div>
 </div>
<script src="../../res/js/wj/common.js" charset="utf-8"></script>
<script type="text/html" id="barDemo">
  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="audit">审核</a>
  <a class="layui-btn layui-btn-xs" lay-event="detail">查看详情</a>
</script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
layui.use('laydate',function(){
	  var laydate = layui.laydate;
	  //执行一个laydate实例
	  laydate.render({
		  elem:'#bwTime'
	  	,theme: 'molv'
	  });
	  laydate.render({
		  elem:'#bwTime2'
	  	,theme: 'molv'
	  });

	});

layui.use('table', function(){
  var table = layui.table;
  
  //监听表格复选框选择
  table.on('checkbox(demo)', function(obj){
    console.log(obj)
  });
  //表单重载
  var $ = layui.$, active = {
		    reload: function(){
			      var bwId = $('#bwId');//批发单号
			      var companyName = $('#companyName');//公司名称
			      var bwTime = $('#bwTime');//开始时间
			      var bwTime2 = $('#bwTime2');//结束时间
		      //执行重载    查询
		      table.reload('idTest', {
		        page: {
		          curr: 1 //重新从第 1 页开始
		        }
		        ,where: {
		        	bwId: bwId.val(),
		        	companyName: companyName.val(),
		        	bwTime1: bwTime.val(),
		        	bwTime2: bwTime2.val(),
		        }
		      });
		    }
		  };
  
  
//监听工具条
  table.on('tool(demo)', function(obj){
    var da = obj.data;
    //审核页面
    if(obj.event === 'audit'){
    	layer.open({
  		  type: 2, //设置为iframe
  		  area: ['40%', '57%'],
  		  content: ['../../pages/wholesalesAudit/audit.html?id='+da.bwId+'', 'no'] //这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
  		  ,end: function(){ 
  			  //渲染刷新页面
  			  /*  location.reload(); */
  		  }
  		  ,success: function(layero, index){
  			 //渲染刷新子页面
  			  iframe.load();
  		  }
  	  }); 
    //查看详情
    } else if(obj.event === 'detail'){
    	
    	layer.open({
    		  type: 2, //设置为iframe
    		  area: ['70%', '60%'],
    		  content: ['../../pages/wholesaleDateil/wholesaleDateil.html?id='+da.bwId+'', 'no'] //这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
    		  ,end: function(){
    			//渲染刷新页面
    			 /* location.reload(); */
    		  }
    		  ,success: function(layero, index){
    			  iframe.load();
    		  }
    	  }); 
    }
  });
  $('.demoTable .layui-btn').on('click', function(){
    var type = $(this).data('type');
    active[type] ? active[type].call(this) : '';
  });
});

</script>
</body>
</html>